package com.bootdo.activiti.controller;

import com.bootdo.activiti.domain.VacationDo;
import com.bootdo.activiti.service.VacationService;
import com.bootdo.activiti.utils.ActivitiUtils;
import com.bootdo.common.controller.BaseController;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/act/vacation")
public class VacationController extends BaseController {
    @Autowired
    ActivitiUtils activitiUtils;
    @Autowired
    VacationService vacationService;

    @GetMapping
    String Vacation(){return "act/vacation/vacation";}

    /**
     * 待办事项的列表
     */
    @ResponseBody
    @GetMapping("/list")
    public PageUtils list(@RequestParam Map<String, Object> params){
        Query query = new Query(params);
        List<VacationDo> vacationList = vacationService.list(query);
        int total = vacationService.total(query);
        PageUtils pageUtils = new PageUtils(vacationList, total);
        return pageUtils;
    }
}
